package com.ByteDance.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import javax.websocket.OnOpen;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;

@Configuration
@EnableWebSocket //配置并启用WebSocket的支持
public class WebSocketConfig {

    /**
     * 通过创建ServerEndpointExporter这个bean，使得spring能够自动扫描和注册带有@ServerEndpoint
     * 注解的webSocket端点，这样在你的程序中就可以方便地创建和管理webSocket端点了
     * @return
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter(){
        return new ServerEndpointExporter();
    }

}
